import { defineMock } from 'umi';

const users = [
  { id: 0, name: 'Umi', nickName: 'U', gender: 'MALE' },
  { id: 1, name: 'Fish', nickName: 'B', gender: 'FEMALE' },
  { id: 2, name: 'Umi', nickName: 'U', gender: 'MALE' },
  { id: 3, name: 'Umi', nickName: 'U', gender: 'MALE' },
  { id: 4, name: 'Umi', nickName: 'U', gender: 'MALE' },
  { id: 5, name: 'Umi', nickName: 'U', gender: 'MALE' },
];

export default defineMock({
  'GET /api/v1/queryUserList': (req: any, res: any) => {
    res.json({
      success: true,
      data: users,
      errorCode: 0,
    });
  },
  'GET /api/v1/userInfo': (req: any, res: any) => {
    res.json({
      success: true,
      data: {
        userInfo: {
          name: 'admin',
          nickName: 'admin',
          phone: '123456789',
          gender: 'MALE',
          email: 'admin@umijs.org',
          dept: 'Ant Design Team',
        },
      },
      errorCode: 0,
    });
  },
  'PUT /api/v1/user/': (req: any, res: any) => {
    res.json({
      success: true,
      errorCode: 0,
    });
  },
});
